import pandas as pd

# 读取数据
df=pd.read_csv('dataset/electric_vehicles_spec_2025.csv.csv')
#删除不需要的列battery_type	fast_charge_port	source_url
df.drop(['number_of_cells','battery_type','fast_charge_port','source_url'],axis='columns',inplace=True)


# 后备箱容积只留数值
df['cargo_volume_l'] = pd.to_numeric(df['cargo_volume_l'], errors='coerce')
# 删除空值
df.dropna(inplace=True)
#删除牵引力0值
df=df[df['towing_capacity_kg']!=0]

#单位转换length_mm	width_mm	height_mm，mm转m
df['length_mm']/=1000
df['width_mm']/=1000
df['height_mm']/=1000
#更改列名
df.rename(columns={'length_mm':'length_m','width_mm':'width_m','height_mm':'height_m'},inplace=True)

#保存数据
df.to_csv('dataset/electric_vehicles_spec_2025_clean.csv',index=False)
